package info.niwota.ziplock;

import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;

/**
 * Encrypt and password protect your data in ZIP files
 * 
 * PUBID: a14c9f3500d6554
 * 
 * @author qiangli
 * 
 */
public class MainActivity extends BaseActivity {

	private static final String TAG = "MainActivity";

	@Override
	protected void doQuit() {
		if (Debug.DEBUG) {
			Log.d(TAG, "doQuit");
		}
		super.doQuit();
		//
		logout(true);
		finish();
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//
		Notifications.addNotification(this);

	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (Debug.DEBUG) {
			Log.d(TAG, "onKeyDown " + keyCode + " event: " + event);
		}
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			finish();
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		super.onPrepareOptionsMenu(menu);
		//
		miQuit.setTitle(R.string.action_quit);
		return true;
	}
}